package com.gollum.web.consumer;

import com.gollum.common.annotation.MQListener;
import com.gollum.common.domain.email.Email;
import com.gollum.common.domain.redis.MqMessage;
import com.gollum.web.service.email.EmailClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 测试
 *
 * @author Herther
 * @createTime 2022年11月03日 00:09:00
 * @since 1.0.0
 */
@Service
@Slf4j
public class EmailConsumer {

    @Autowired
    protected EmailClient emailCient;

    @MQListener("testEmail")
    public void test(MqMessage<Email> redisMessage) {
        Email email = redisMessage.getData();
        log.info("处理发送测试邮箱业务：[{}]",email.getReceives());
        //执行发送邮箱逻辑
        emailCient.sendEmailTo(email);
    }

}
